package kr.priv.contest;

import java.net.URL;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;


public class ParseTestActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        String str = "";
        
        try{
        	URL url = new URL("http://www.kma.go.kr/wid/queryDFS.jsp?gridx=62&gridy=128");
        	
        	XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        	XmlPullParser parser = factory.newPullParser();
        	Toast.makeText(this, "asdfasdf", 0).show();
        	parser.setInput(url.openStream(), "utf-8");

        	int eventType = parser.getEventType();
        	
        	while(eventType != XmlPullParser.END_DOCUMENT){
        		switch(eventType){
        		case XmlPullParser.START_DOCUMENT:
        			break;
        		case XmlPullParser.END_DOCUMENT:
        			break;
        		case XmlPullParser.TEXT:
        			Log.d("zzzzzzzzzz", "zzzzzzzzzz");
        			str += parser.getText();  
        			break;
        		}
        		eventType = parser.next();
        	}
        	
        }catch(Exception e){
        	Toast.makeText(this, e.getMessage(), 0).show();
        }
        
//        TextView textview = (TextView)findViewById(R.id.text);
//        textview.setText(str);
    }
}